import React from 'react'


function AddresList(props) {
    const {addres,open,openAlter,removeaddres,
      editDefault,topbu}=props
  return (
    <div>
        {
            addres ?addres.map((item,index)=>{
                return    <div>
             
                <li key={index}>
                     <input type="checkbox" 
                     checked={item.isDefault} 
                      onChange={()=>{
                        editDefault(item.id)
                     }}/>
                    {item.name}
                  <p> {item.province}
                    {item.phone}
                    {item.city}
                    {item.addres}
                    {item.area} </p>  
                    <p><button
                    onClick={
                      ()=>{
                        removeaddres(item.id)
                      }
                    }>删除</button> 
                    
                    <button onClick={()=>{
                      open()
                      openAlter(item)

                      
                    }}>编辑</button> 
                    <button onClick={()=>{
                      topbu(index)


                    }}>置顶</button>
                    
                    </p>
           
               </li>
               <span onClick={
                   ()=>{
                       open()
                   }
               }>增加</span>
               </div>
             
            })
               :'暂无数据'
                
        }
    </div>
  )
}

export default AddresList